package com.sy.wz.demo.service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.sy.core.exception.BusinessException;
import com.sy.wz.demo.model.UserMapper;
import com.sy.wz.demo.model.UserPo;
import org.springframework.stereotype.Service;

/**
 * Create by wongloong on 17-8-17
 */
@Service("userService")
public class UserService extends ServiceImpl<UserMapper, UserPo> {

    /**
     * 异常测试
     *
     * @return
     * @throws BusinessException
     */
    public boolean addTestTran() throws BusinessException {
        UserPo u1 = new UserPo();
        u1.setUsername("tran1");
        this.insert(u1);
        if (true)
            throw new BusinessException("业务异常");
        UserPo u2 = new UserPo();
        u2.setUsername("tran2");
        this.insert(u2);
        return true;
    }
}
